<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title><!--{$lang.page.index.title}--></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/lay/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/lay/layui/index.css" media="all">
</head>
<body>
<div style="padding-top: 20px">
    <div class="layui-text-item" style="text-align: center;"><b><!--{$lang.page.public.control}--></b></div>
     <div class="layui-card">
      <div class="layui-form layuiadmin-card-header-auto" >
        <div class="layui-text-item">
          <div class="layui-text-line">
            <label class="layui-text-label"><!--{$lang.page.table.name}--></label>
            <div class="layui-text-inline">
              <!--{$datainfo.title}-->
            </div>
          </div>
          <div class="ayui-text-line">
            <label class="layui-text-label">ID</label>
            <div class="layui-text-inline">
              <!--{$datainfo.id}-->
            </div>
          </div>
          <div class="layui-text-line">
            <label class="layui-text-label"><!--{$lang.page.table.status}--></label>
            <div class="layui-text-inline">
              <!--{if $datainfo.status==1}-->
              <button class="layui-btn layui-btn-xs" type="button"><!--{$lang.page.table.normal}--></button>
              <!--{elseif $datainfo.status==2}-->
              <button class="layui-btn layui-btn-green layui-btn-xs" type="button"><!--{$lang.page.table.finish}--></button>
              <!--{elseif $datainfo.status==3}-->
              <button class="layui-btn layui-btn-primary layui-btn-xs" type="button"><!--{$lang.page.table.tovoid}--></button>
              <!--{/if}-->
            </div>
          </div>
        </div>
      </div>
     </div>
    </div>
    <div >
      <div class="layui-card-body">
        <form name="addItem" method="post" lay-filter="component-form-group" class="layui-form">
          <input type="hidden" value="<!--{$datainfo.id}-->" name="id">
          <input type="hidden" value="<!--{$datainfo.operate_id}-->" name="operate_id">

          <div class="layui-form-item">
            <label class="layui-form-label"><!--{$lang.page.public.control}--></label>
            <div class="layui-input-block">
              <input type="radio" name="win" value="0" title="<!--{$lang.page.public.nocontrol}-->" <!--{if $datainfo.win eq 0}--> checked<!--{/if}-->  >&nbsp;&nbsp;<input type="radio" name="win" value="1" title="<!--{$lang.page.table.upwin}-->" <!--{if $datainfo.win eq 1}--> checked<!--{/if}-->  >&nbsp;&nbsp;<input type="radio" name="win" value="2" title="<!--{$lang.page.table.downwin}-->" <!--{if $datainfo.win eq 2}--> checked<!--{/if}-->>
            </div>
          </div>
                  
          <div class="layui-form-item layui-layout-admin">
            <div>
              <div class="layui-footer" style="left: 0;">
                <!--{if $datainfo.status neq 2}-->
                <button class="layui-btn" type="button" id="submit" lay-submit lay-filter="submit"><!--{$lang.page.public.submit}--></button>
                <button type="reset" id="reset" class="layui-btn layui-btn-primary"><!--{$lang.page.public.reset}--></button>
                <!--{/if}-->
                <button type="button" class="layui-btn layui-btn-primary" onClick="xadmin.close('1');" ><!--{$lang.page.table.close}--></button>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
<script src="/static/lay/layui/layui.js"></script>
  <script type="text/javascript">
    layui.config({
     base: '/static/lay/' //静态资源所在路径
   }).extend({
     xadmin: 'lib/xadmin' //弹窗
   }).use(['jquery', 'layer','xadmin', 'form', 'element'], function(){
    var $ = layui.$ //引用jq
    var layer = layui.layer; //独立版的layer无需执行这一句
    var form = layui.form;
     form.render(null, 'component-form-group');
     /* 自定义验证规则 */
    form.verify({
      title: function(value){
        if(value.length < 1){
          return '<!--{$lang.page.table.name}--> <!--{$lang.page.public.nocontent}-->';
        }
      }
      ,double: function(value){
        if(/^\d+$/.test(value)==false && /^\d+\.\d+$/.test(value)==false)
        {
            return '<!--{$lang.page.public.paraerror}-->';
        }
      }
      ,description: function(value) {
          return layedit.sync(description);
        }
    });

    form.on('submit(submit)', function (data) {
          $('#submit').attr("disabled",true);
          $('#submit').addClass('layui-btn-disabled');
              $.post('#',data.field,function(res){
                  if(res.code == 200){
                      layer.msg(res.msg);
                      setTimeout(() => {
                          window.location.reload();
                          // xadmin.close();
                      }, 1000);
                  }else{
                      layer.msg(res.msg);
                  }
              })
        return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    });
    //重置按钮，可以提交失败的时候再次提交
    $('#reset').click(function(){
        $('#submit').removeAttr("disabled");
        $('#submit').removeClass('layui-btn-disabled');
    });

  });

  </script>
</body>
</html>

